Here's the code you've already written for this game.

  • Click Run to play the game. Explore the code and make sure you remember how it works.
  • If you customized your game at the end of the last lesson, you can use copy-paste to bring in your own code.

Highlight the text you want and press ctrl + c. Click where you want to put the text, and press ctrl + v.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("schoolhallway") sprite = codesters.Sprite("person8", 0, -220) stage.set_gravity(4) stage.disable_floor() sprite.gravity_off() score = 0 score_board = codesters.Display(score) my_info = ["cellphone", "address", "birthdate"] def left(): sprite.move_left(20) # add other actions... stage.event_left_key(left) def right(): sprite.move_right(20) # add other actions... stage.event_right_key(right) def interval(): info_img = random.choice(my_info) x = random.randint(-230, 230) info = codesters.Sprite(info_img, x, 275) # add any other actions... stage.event_interval(interval, 2) def collision(sprite, hit_sprite): global score stage.remove_sprite(hit_sprite) score += 1 score_board.update(score) # add any other actions... sprite.event_collision(collision)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)